<template>
  <div>
    <el-card>
      <el-breadcrumb separator="/" class="box-card">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>权限管理</el-breadcrumb-item>
        <el-breadcrumb-item>权限列表</el-breadcrumb-item>
      </el-breadcrumb>

      <el-table :data="tableData" border style="width: 100%;height:390">
        <el-table-column type="index" label="序号">
        </el-table-column>
        <el-table-column prop="authName" label="权限名称">
        </el-table-column>
        <el-table-column prop="path" label="路径"> </el-table-column>
        <el-table-column label="权限级别">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.level==0">一级</el-tag>
                <el-tag v-if="scope.row.level==1" type="success">二级</el-tag>
                <el-tag v-if="scope.row.level==2" type="warning">三级</el-tag>
            </template>
            
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "rights",
  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    async query() {
      let rst =await this.$http.get("/rights/list");
      if (rst.meta.status == 200) {
        this.tableData = rst.data;
      } else {
        this.$message.error("权限列表获取失败");
      }
      console.log(rst);
    },
  },
  mounted() {
    this.query();
  },
};
</script>

<style>
.box-card {
  padding-bottom: 10px;
}
</style>